package com.yuan.base.framework;

import org.xutils.DbManager;

/**
 * 需要主工程在自定义Application中实现的方法
 */
public class BaseCommonInterface {

	private static BaseCommonInterface.HttpCallBackHandle httpCallBackHandle;

	public static void registerHttpCallBackHandleImpl(BaseCommonInterface.HttpCallBackHandle httpCallBackHandle) {
		BaseCommonInterface.httpCallBackHandle = httpCallBackHandle;
	}

	public static BaseCommonInterface.HttpCallBackHandle getHttpCallBackHandle() {
		return httpCallBackHandle;
	}

	private static BaseCommonInterface.DBUtilsInterface dbUtilsInterface;

	public static void registerDbUtilsInterfaceImpl(BaseCommonInterface.DBUtilsInterface dbUtilsInterface) {
		BaseCommonInterface.dbUtilsInterface = dbUtilsInterface;
	}

	public static BaseCommonInterface.DBUtilsInterface getDbUtilsInterface() {
		return dbUtilsInterface;
	}


	//Http相关
	public interface HttpCallBackHandle {
		//登录超时
		void onTimeOut();

		//http请求默认的错误处理方法(主要实现toast提示)
		void onDefaultFailure(int code, String msg);
	}

	public interface DBUtilsInterface {
		DbManager getDbUtil();
	}
}
